package src.greedy_algorithms;

import java.awt.font.TextAttribute;

/**
 * @author starsea
 * @date 2024-09-01 17:31
 */

public class Test07 {
    public static void main(String[] args) {
        int startValue = 3;
        int target = 10;
        int c=brokenCalc(startValue,target);
    }
    public static int brokenCalc(int startValue, int target) {
        //正难则反
        int sum=0;
        while(target!=startValue){
            if(target<startValue)
            {
                sum++;
                target++;
            }else if(target%2==0){
                sum++;
                target/=2;
            }else{
                sum++;
                target++;
            }

        }
        return sum;
    }
}
